
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    String path = request.getContextPath();
%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<h4 style="margin-left: 90px;">匹配选项</h4>
<input class="flag" value="${requestScope.flag}" type="hidden">
<c:forEach items="${requestScope.garbages}" var="garbage">
    <nav>
        <div id="breadcrumb" style="margin-left: 90px;">
            <ul>
                <li><a href="#">${garbage.garbageType.title}</a><span>&gt;</span></li>
                <li><a href="#">${garbage.texture.texture.title}</a><span>&gt;</span></li>
                <li><a href="#">${garbage.texture.title}</a><span>&gt;</span></li>
                <li><a href="#">${garbage.name}</a></li>
                <li><a href="script:void(0);" data-id="${garbage.id}" data-title="${garbage.name}" class="adopt">采用</a></li>
            </ul>
        </div>
    </nav>
</c:forEach>
<script src="<%=path%>/static/js/jquery-3.3.1.min.js"></script>
<script>
    //给采用添加点击事件，将垃圾名字放进搜索框
    $(function () {
        $(".adopt").click(function () {
            var text=$(this).data("title");
            var id=$(this).data("id");
            $(".find").val(text);
            $(".find").attr("id",id);
            $("#match").html("匹配成功")
            $(".hidener").val(id);//将垃圾id放到一个隐藏的标签value中，便于取值
        })
    })
</script>


